<!--订单详情-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>房间查询</title>
    <link rel="stylesheet" href="/hotel/css/layui.css">
    <link rel="stylesheet" href="../css/bootstrap.min.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">MISS后台管理系统</div>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    username
                </a>
            </li>
            <li class="layui-nav-item"><a href="">注销</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <!-- 侧边导航: <ul class="layui-nav layui-nav-tree layui-nav-side"> -->
                <li class="layui-nav-item">
                    <a href="index.html">首页</a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">散客开单</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Guests_check_in.html">宾客入住</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">订单</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Order.html">所有订单</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">宾客结账</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Ordinary_invoicing.html">结账</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">预定管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Query_book.html">查询预定</a></dd>
                        <dd><a href="Add_a_reservation.html">添加预定</a></dd>\
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">营业查询</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Check-in_guest_enquiry.html">入住宾客查询</a></dd>
                        <dd><a href="Member_of_the_query.html">会员查询</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">系统设置</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Data_management.html">数据管理</a></dd>
                        <dd><a href="VIP_set_up.html">VIP设置</a></dd>
                        <dd><a href="Billing_Settings.html">计费设置</a></dd>
                        <dd><a href="Set_up_the_room.html">房间设置</a></dd>
                        <dd><a href="Operator_setup.html">操作员设置</a></dd>
                    </dl>
                </li>
                 <li class="layui-nav-item">
                    <a href="javascript:;">订单信息</a>
                    <dl class="layui-nav-child">
                    <dd><a href="javascript:void(0);" onclick="tan()">查看订单信息</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <div style="padding: 15px;">
            <h2>订单号：</h2><br/>
            <h3>宾客信息</h3>
            <table class="layui-table">
                <colgroup>
                    <col width="150">
                    <col width="150">
                    <col width="150">
                    <col width="150">
                    <col width="150">
                </colgroup>
                <thead>
                <tr>
                    <th>宾客姓名</th>
                    <th>宾客身份证</th>
                    <th>宾客手机号</th>
                    <th>入住时间</th>
                    <th>离店时间</th>
                </tr>
                </thead>
                <tbody id="tbody1">
                <tr>
                    <td>郑杰</td>
                    <td>510xxxxxxxxxxxxx</td>
                    <td>123456789</td>
                    <td>2019-6-24 11:11</td>
                    <td>2019-6-25 12:00</td>
                </tr>
                </tbody>
            </table>
            <h3>房间信息</h3>
            <table class="layui-table">
                <colgroup>
                    <col width="150">
                    <col width="150">
                    <col width="150">
                    <col width="150">
                    <col width="150">
                    <col width="150">
                    <col width="150">
                </colgroup>
                <thead>
                <tr>
                    <th>房间类型</th>
                    <th>房间号</th>
                    <th>总价格</th>
                    <th>是否支付</th>
                    <th>押金状态</th>
                    <th>押金金额</th>
                    <th>订单状态</th>
                </tr>
                </thead>
                <tbody id="tbody2">
                <tr>
                    <td>单人间</td>
                    <td>001</td>
                    <td>123.00</td>
                    <td>已支付</td>
                    <td>已交</td>
                    <td>100</td>
                    <td>未入住</td>
                </tr>
                </tbody>
            </table>
            <button type="button" id="button2" class="layui-btn layui-btn-radius layui-btn-normal"><a href="Order.html">返回订单页面</a></button>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © MISS酒店
    </div>
</div>
 <div class="modal fade" id="webSocketModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
  <div class="modal-dialog" style="height: 300px">
    <div class="modal-content" >
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">订单信息</h4>
      </div>
      <div class="modal-body" style="height: 300px">
        <div class="form-group" style="float: left;"></br>
			 <textarea id="message_content" class="form-control" readonly="readonly" cols="80" rows="10"></textarea>
		</div>
       </div>
    </div>
  </div>
</div><!-- /.modal -->
<script src="/hotel/js/layui.all.js"></script>
<script src="/hotel/js/jquery.min.js"></script>
 <script src="../bt/modal.js"></script>
<script>
function tan(){
	$("#webSocketModal").modal('show')
}
	function findMes(){
		var url = location.search;
		var id;
		if(url.indexOf("?") != -1){
			m = url.substr(1);
			m1 = m.split("=");
			id = m1[1];
		}
		$.ajax({
			url:"/order/id/"+id+"",
	        type:"get",
	        async:true,
	        success:function (mes){
	        	console.info(mes)
	       		var str="";
	       		str+="<tr><td>"+mes.ocb[0].guestId.name+"</td><td>"+mes.ocb[0].guestId.idCard+"</td><td>"+mes.ocb[0].guestId.gender+"</td><td>"+mes.ocb[0].startTime+"</td><td>"+mes.ocb[0].endTime+"</td></tr>";
	       		$("#tbody1").html(str);
	       		var h = $("h2").text();
	       		h+=mes.orderNumber;
	       		$("h2").html(h);
	       		var str1="";
     				if(mes.ocb[0].roomId==null){
     					str1+="<tr><td>"+mes.ocb[0].roomtype.name+"</td><td>待开</td><td>"+mes.totalPrice+"</td><td>"+mes.payType+"</td><td>"+mes.depositStatus+"</td><td>"+mes.deposit+"</td><td>"+mes.status+"</td></tr>";
     				}else{
     					str1+="<tr><td>"+mes.ocb[0].roomtype.name+"</td><td>"+mes.ocb[0].roomId.roomNumber+"</td><td>"+mes.totalPrice+"</td><td>"+mes.payType+"</td><td>"+mes.depositStatus+"</td><td>"+mes.deposit+"</td><td>"+mes.status+"</td></tr>";
     				}
	       		$("#tbody2").html(str1);
	        }
		});
	}
	findMes();
</script>
<script type="text/javascript">

var websocket = null;
//浏览器是否支持
if ('WebSocket' in window) {
  // 上面我们给webSocket定位的路径
  websocket = new WebSocket('ws://192.168.3.103:8080/webSocket');
} else {
  alert('该浏览器不支持websocket!');
}
//建立连接
websocket.onopen = function (event) {
  console.log('建立连接');
				
}
//关闭连接
websocket.onclose = function (event) {
  console.log('连接关闭');
}
//消息来的时候的事件
websocket.onmessage = function (event) {
  // 这里event.data就是我们从后台推送过来的消息
  console.log('收到消息:' + event.data);
  $('#message_content').append(event.data+'\n');
  // 在这里我们可以在页面中放置一个音乐，例如“您有新的订单了！”这样的提示音
  	document.getElementById("myAudio").play();
}

//发生错误时
websocket.onerror = function () {
  alert('websocket通信发生错误！');
}
//窗口关闭时，Websocket关闭
window.onbeforeunload = function () {
  websocket.close();
}

</script>
<audio src="../video/dingdong.mp3"  id="myAudio" ></audio>
</body>
</html>